//
//  UIEngine.h
//  iphone_recharge
//
//  Created by xuyue on 12-8-16.
//  Copyright 2012 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <MessageUI/MessageUI.h>
#import "Screen.h"
#import "HPCFDelegate.h"
#import "CategoryUtil.h"
#import "AlertData.h"
#import "CallbackData.h"
#import "HPAlertProgressView.h"
#import "HPWaittingView.h"

#include "luaEngine.h"

#define HPUIENG [HPUIEngine getInstance]

@interface HPUIEngine : NSObject <UIAlertViewDelegate>{
	CGFloat scrWidth;
	CGFloat scrHeight;
	
    id<HPUIDelegate> hpUIDelegate;
    id<HPUtilDelegate> hpUtilDelegate;
    
@private
    UIAlertView* mAlertView; // 只保留一个alertView
    AlertData* mAlertData;   // 对话框的数据
    UIAlertController *mAlertController;
    HPWaittingView* waittingView;
}

+ (HPUIEngine*)getInstance;
+ (void)releaseInstance;

- (Screen*)createScreen:(NSString*)screenName params:(NSDictionary*)screenData; // 创建界面
- (void)showScreen:(NSString*)screenName params:(NSDictionary*)screenData; // 显示界面
- (void)showScreen:(NSString*)screenName; // 显示界面
- (void)showIndex:(NSInteger)index;  // 根据索引号显示第几页
- (void)showIndex:(NSNumber*)index params:(NSDictionary*)params;  // 根据索引号显示第几页
- (void)showWelcomeScreen;
- (void)removeWelcomeScreen;
- (void)popToLoginScreen;

- (void)popScreen;
- (void)popScreenWithAnimations:(BOOL)animations;
- (void)popScreenByNum:(int)num;
- (void)popScreenByViewController:(UIViewController*)viewController;
- (void)popToRootScreen;

- (Screen*)topScreen;

- (Screen*)getCurrentScreen; // 返回当前Screen

- (void)showAlert:(NSString*)msg;
- (void)showAlert:(NSString*)title msg:(NSString*)msg;
- (void)showAlertWithData:(AlertData*)alertData;

- (void)showTips:(NSString*)msg;
- (void)showWaiting:(NSString*)msg;
- (void)showProgress:(NSString*)msg steps:(NSUInteger)steps;
- (void)showToast:(NSString*)msg;

- (void)removeAlert;
- (void)removeTips;
- (void)removeWaiting;

-(void)showSMSPicker:(NSString*)msg phoneNo:(NSString*)phone;

-(void)DoBrowsUI:(NSString * ) url;
-(void)DoSmsUI:(NSDictionary * )dict;
-(void)DoCallUI:(NSString *) call;
-(void)DoExit;

-(void)keyBoardShow:(NSNotification*)anotification;
-(void)keyBoardHide:(NSNotification*)anotification;

- (BOOL)doCheckGPSStatus;
-(void)getAddressWithGPS:(CallbackData*)callback;
-(void)getAddressWithGPSBlock:(void(^)(NSString* latitude, NSString* longitude, NSString* address, NSError* error))addressBlock;

@property(nonatomic, assign) id<HPUIDelegate> hpUIDelegate;
@property(nonatomic, assign) id<HPUtilDelegate> hpUtilDelegate;
@property(nonatomic) CGFloat scrWidth;
@property(nonatomic) CGFloat scrHeight;
@property(nonatomic, retain) UIAlertView* mAlertView;
@property(nonatomic, retain) HPWaittingView *waittingView;
@property(nonatomic, retain) UIAlertController* mAlertController;
@property(nonatomic, strong) HPAlertProgressView* progressView;
@property(nonatomic, retain) AlertData* mAlertData;
@property(nonatomic) CGSize keyBoardSize;
@end
